/**
* ...
* @author Default
* @version 0.1
*/

package bdz.cms.core.events {
	import flash.events.Event;
	public class CMSEvent extends Event {
		
		public static const CATEGORY_LOADED:String = "cat_loaded";
		public static const CATEGORY_DELETED:String = "cat_deleted";
		public static const CATEGORY_ADDED:String = "cat_added";
		public static const CATEGORY_MODIFIED:String = "cat_modified";
		public static const CATEGORY_INFO_LOADED:String = "cat_info_loaded";
		
		public static const CONTENT_LOADED:String = "content_loaded";
		public static const CONTENT_DELETED:String = "content_deleted";
		public static const CONTENT_ADDED:String = "content_added";
		public static const CONTENT_MODIFIED:String = "content_modified";
		
		public static const MEDIA_LOADED:String = "media_loaded";
		public static const MEDIA_DELETED:String = "media_deleted";
		public static const MEDIA_ADDED:String = "media_added";
		public static const MEDIA_MODIFIED:String = "media_modified";
		
		public static const META_LOADED:String = "meta_loaded";
		public static const META_DELETED:String = "meta_deleted";
		public static const META_ADDED:String = "meta_added";
		public static const META_MODIFIED:String = "meta_modified";
		
		public static const LOGIN_STATUS:String = "login_status";
		
		
		public static const PROCESSING_START:String = "processing_start";
		public static const PROCESSING_END:String = "processing_end";
		
		
		public var data:*;
		
		function CMSEvent(tpe:String, info:*) {
			super(tpe);
			data = info;
		}
		public static function typeCheck(evt:String):String {
			var toreturn:String;
			if (evt.indexOf("media_") != -1) {
				toreturn =  "media";
			}
			if (evt.indexOf("content_") != -1) {
				toreturn = "content";
			}
			if (evt.indexOf("cat_") != -1) {
				toreturn = "category";
			}
			if(evt.indexOf("login_") != -1){
				toreturn = "login";
			}
			return toreturn;
		}
		override public function clone():Event{
			return new CMSEvent(type, data);
		}
		
	}
	
}